﻿using System.Reflection;

namespace TemplateFoundation.Reflection
{
    /// <summary>
    /// Helper methods for working with an assembly, especially to simplify getting assembly information
    /// </summary>
    public class AssemblyHelper
    {
        /// <summary>
        /// Initializes the assembly helper and sets its public properties
        /// </summary>
        /// <param name="assembly"></param>
        public AssemblyHelper(Assembly assembly)
        {
            // Get assembly name without any .DLL file extension
            Assembly = assembly;
            AssemblyName = Assembly.ManifestModule.Name;
            AssemblyName = AssemblyName.Substring(0, AssemblyName.Length - 4);
        }

        /// <summary>
        /// Gets the assembly name
        /// </summary>
        public string AssemblyName
        {
            get; private set;
        }

        /// <summary>
        /// Gets the gadgets assembly
        /// </summary>
        public Assembly Assembly
        {
            get;
            private set;
        }
    }
}